package com.k8s.base.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * 二维码活码
 */
@Entity
@Table(name = "qr_code")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class QrCode implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    /**
     * 地址分类
     */
    @Size(max = 50)
    @Column(name = "kind", length = 50)
    private String kind;

    /**
     * 重定向地址
     */
    @Size(max = 255)
    @Column(name = "redirect_url", length = 255)
    private String redirectUrl;

    /**
     * 备注
     */
    @Size(max = 255)
    @Column(name = "memo", length = 255)
    private String memo;

    /**
     * 编辑链接地址时提供此key
     */
    @Size(max = 50)
    @Column(name = "edit_key", length = 50)
    private String editKey;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @CreatedDate
    private ZonedDateTime createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    @LastModifiedDate
    private ZonedDateTime updateTime;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public String getId() {
        return id;
    }
    public QrCode id(String id) {
        this.id = id;
        return this;
    }
    public void setId(String id) {
        this.id = id;
    }

    public String getKind() {
        return kind;
    }

    public QrCode kind(String kind) {
        this.kind = kind;
        return this;
    }

    public void setKind(String kind) {
        this.kind = kind;
    }

    public String getRedirectUrl() {
        return redirectUrl;
    }

    public QrCode redirectUrl(String redirectUrl) {
        this.redirectUrl = redirectUrl;
        return this;
    }

    public void setRedirectUrl(String redirectUrl) {
        this.redirectUrl = redirectUrl;
    }

    public String getMemo() {
        return memo;
    }

    public QrCode memo(String memo) {
        this.memo = memo;
        return this;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getEditKey() {
        return editKey;
    }

    public QrCode editKey(String editKey) {
        this.editKey = editKey;
        return this;
    }

    public void setEditKey(String editKey) {
        this.editKey = editKey;
    }

    public ZonedDateTime getCreateTime() {
        return createTime;
    }

    public QrCode createTime(ZonedDateTime createTime) {
        this.createTime = createTime;
        return this;
    }

    public void setCreateTime(ZonedDateTime createTime) {
        this.createTime = createTime;
    }

    public ZonedDateTime getUpdateTime() {
        return updateTime;
    }

    public QrCode updateTime(ZonedDateTime updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public void setUpdateTime(ZonedDateTime updateTime) {
        this.updateTime = updateTime;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        QrCode qrCode = (QrCode) o;
        if (qrCode.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), qrCode.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "QrCode{" +
            "id=" + getId() +
            ", kind='" + getKind() + "'" +
            ", redirectUrl='" + getRedirectUrl() + "'" +
            ", memo='" + getMemo() + "'" +
            ", editKey='" + getEditKey() + "'" +
            ", createTime='" + getCreateTime() + "'" +
            ", updateTime='" + getUpdateTime() + "'" +
            "}";
    }
}
